import java.util.*;

/**
 * Author: Daniel Michalski
 * Date: 12.03.13
 */

public class CalendarTest {
    public static void main(String[] args) {
        gregorianCelandarTest();
    }

    private static void gregorianCelandarTest() {
        String[] month = {
                "Sty", "Lut", "Mar",
                "Kwi", "Maj", "Cze",
                "Lip", "Sie", "Wrz",
                "Paź", "Lis", "Gru"
        };

        GregorianCalendar gc = new GregorianCalendar();

        System.out.println(gc.get(Calendar.DAY_OF_MONTH) + " " +
                           (month[gc.get(Calendar.MONTH)]) + " " +
                           gc.get(Calendar.YEAR));
    }

    private static void calendarTest() {
        String[] months = {
                "Sty", "Lut", "Mar", "Kwi",
                "Maj", "Cze", "Lip", "Sie",
                "Wrz", "Paź", "Lis", "Gru",
        };

        Calendar calendar = Calendar.getInstance();

        System.out.print("Data: ");
        System.out.print(calendar.get(Calendar.DAY_OF_MONTH));
        System.out.print(". " + months[calendar.get(Calendar.MONTH)] + " ");
        System.out.println(calendar.get(Calendar.YEAR));

        System.out.print("Godzina: ");
        System.out.print(calendar.get(Calendar.HOUR) + ":");
        System.out.print(calendar.get(Calendar.MINUTE) + ":");
        System.out.println(calendar.get(Calendar.SECOND));

        calendar.set(Calendar.HOUR, 10);
        calendar.set(Calendar.MINUTE, 29);
        calendar.set(Calendar.SECOND, 22);

        System.out.print("Zaktualizowana godzina: ");
        System.out.print(calendar.get(Calendar.HOUR) + ":");
        System.out.print(calendar.get(Calendar.MINUTE) + ":");
        System.out.println(calendar.get(Calendar.SECOND));
    }

    private static void dateTest() {
        Date date = new Date();

        System.out.println(date);
        long msec = date.getTime();
        System.out.println("Milisekundy od 1 stycznia 1970 roku (GMT) " + msec);
    }

    private static void stringTokanizerTest() {
        String in =
                "tytuł=Java. Kompendium programisty;" +
                        "autor=Schildt;" +
                        "wydawca=Helion;" +
                        "copyright=2011;";

        StringTokenizer tokenizer = new StringTokenizer(in, "=;");

        while (tokenizer.hasMoreTokens()) {
            String key = tokenizer.nextToken();
            String val = tokenizer.nextToken();
            System.out.println(key + "\t" + val);
        }
    }
}